package douyin

import "time"

// Profile DTOs
type CreateProfileRequest struct {
	Name     string `json:"name" binding:"required"`
	URL      string `json:"url" binding:"required"`
	Platform string `json:"platform" binding:"required"`
	Type     string `json:"type"`
}

type UpdateProfileRequest struct {
	Name       *string `json:"name"`
	URL        *string `json:"url"`
	IsActive   *bool   `json:"is_active"`
	Status     *string `json:"status"`
	VideoCount *int    `json:"video_count"`
}

// Video DTOs
type CreateVideoRequest struct {
	ProfileID      string `json:"profile_id" binding:"required"`
	Title          string `json:"title" binding:"required"`
	ExtractType    string `json:"extract_type"`
	ContentType    string `json:"content_type"`
	Duration       string `json:"duration"`
	Resolution     string `json:"resolution"`
	PublishTime    string `json:"publish_time"`
	HasProduct     bool   `json:"has_product"`
	AudioText      string `json:"audio_text"`
	Keywords       string `json:"keywords"`
	Author         string `json:"author"`
	AuthorID       string `json:"author_id"`
	AuthorAvatar   string `json:"author_avatar"`
	ViewCount      int    `json:"view_count"`
	LikeCount      int    `json:"like_count"`
	CommentCount   int    `json:"comment_count"`
	ShareCount     int    `json:"share_count"`
	VideoURL       string `json:"video_url"`
	CoverURL       string `json:"cover_url"`
	Description    string `json:"description"`
	Tags           string `json:"tags"`
	Platform       string `json:"platform" binding:"required"`
}

type UpdateVideoRequest struct {
	Title          *string `json:"title"`
	DownloadStatus *string `json:"download_status"`
	FilePath       *string `json:"file_path"`
	FileSize       *int64  `json:"file_size"`
}

// User DTOs
type SaveUserInfoRequest struct {
	ID             string `json:"id" binding:"required"`
	Nickname       string `json:"nickname"`
	Avatar         string `json:"avatar"`
	Description    string `json:"description"`
	FollowerCount  int    `json:"follower_count"`
	FollowingCount int    `json:"following_count"`
	VideoCount     int    `json:"video_count"`
	LikeCount      int    `json:"like_count"`
	Verified       bool   `json:"verified"`
	Platform       string `json:"platform" binding:"required"`
	ProfileURL     string `json:"profile_url"`
}

// Video List DTOs
type VideoListRequest struct {
	ProfileID      *string `json:"profile_id"`
	Platform       *string `json:"platform"`
	DownloadStatus *string `json:"download_status"`
	Author         *string `json:"author"`
	HasProduct     *bool   `json:"has_product"`
	StartDate      *string `json:"start_date"`      // 开始日期
	EndDate        *string `json:"end_date"`        // 结束日期
	MinViewCount   *int    `json:"min_view_count"`  // 最小播放量
	MaxViewCount   *int    `json:"max_view_count"`  // 最大播放量
	MinLikeCount   *int    `json:"min_like_count"`  // 最小点赞数
	MaxLikeCount   *int    `json:"max_like_count"`  // 最大点赞数
	Keywords       *string `json:"keywords"`        // 关键词搜索
	SortBy         *string `json:"sort_by"`         // 排序字段: publish_time, view_count, like_count, created_at
	SortOrder      *string `json:"sort_order"`      // 排序方向: asc, desc
}

type VideoListResponse struct {
	Videos []VideoWithProfile `json:"videos"`
	Total  int64               `json:"total"`
	Page   int64               `json:"page"`
	Size   int64               `json:"size"`
}

type VideoWithProfile struct {
	ID             string    `json:"id"`
	ProfileID      string    `json:"profile_id"`
	ProfileName    string    `json:"profile_name"`    // 档案名称
	Title          string    `json:"title"`
	ExtractType    string    `json:"extract_type"`
	ContentType    string    `json:"content_type"`
	Duration       string    `json:"duration"`
	Resolution     string    `json:"resolution"`
	DownloadStatus string    `json:"download_status"`
	PublishTime    string    `json:"publish_time"`
	HasProduct     bool      `json:"has_product"`
	AudioText      string    `json:"audio_text"`
	Keywords       string    `json:"keywords"`
	Author         string    `json:"author"`
	AuthorID       string    `json:"author_id"`
	AuthorAvatar   string    `json:"author_avatar"`
	ViewCount      int       `json:"view_count"`
	LikeCount      int       `json:"like_count"`
	CommentCount   int       `json:"comment_count"`
	ShareCount     int       `json:"share_count"`
	VideoURL       string    `json:"video_url"`
	CoverURL       string    `json:"cover_url"`
	Description    string    `json:"description"`
	Tags           string    `json:"tags"`
	Platform       string    `json:"platform"`
	CrawledAt      time.Time `json:"crawled_at"`
	FilePath       string    `json:"file_path"`
	FileSize       int64     `json:"file_size"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
}

type BatchVideoRequest struct {
	VideoIDs []string `json:"video_ids" binding:"required"`
}

type BatchUpdateVideoStatusRequest struct {
	VideoIDs       []string `json:"video_ids" binding:"required"`
	DownloadStatus string   `json:"download_status" binding:"required"`
}

type VideoStatsRequest struct {
	ProfileID *string `json:"profile_id"`
	Platform  *string `json:"platform"`
	StartDate *string `json:"start_date"`
	EndDate   *string `json:"end_date"`
}

type VideoStatsResponse struct {
	TotalVideos      int64  `json:"total_videos"`
	TotalViewCount   int64  `json:"total_view_count"`
	TotalLikeCount   int64  `json:"total_like_count"`
	TotalComments    int64  `json:"total_comments"`
	TotalShares      int64  `json:"total_shares"`
	DownloadedCount  int64  `json:"downloaded_count"`
	PendingCount     int64  `json:"pending_count"`
	FailedCount      int64  `json:"failed_count"`
	AvgViewCount     float64 `json:"avg_view_count"`
	AvgLikeCount     float64 `json:"avg_like_count"`
	ProductVideoCount int64  `json:"product_video_count"`
}